<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home_Model extends CI_Model
{
    protected $_lang = '';
	function __construct() {
        parent::__construct();
    }
    public function initialise($lang)
    {
        if($lang!=''&&$lang!='vn')
            $this->_lang = '_'.$lang;
        else
            $this->_lang = '';
    }
   
    /*
     * @author : Tran Thi Kim Que
     * @method : get all product category
     * @param  : $id_cat - ID category news
     * @date   : 09/04/2013
     * @modify :
     */
	 // lấy danh sach sản phẩm mới nhất
    function getNewProducts($limit=0){
		$this->db->select('products_id,code,image,name,name_alias,title,image,viewed,sprice,price,description');
		$this->db->where('bl_active',1);
        $this->db->order_by('products_id','DESC');
        return $this->db->get('products',$limit,0)->result();
    }
	// Danh sách sản phẩm bán chạy nhất
	 function getViewProducts($limit=0){
		$this->db->select('products_id,code,image,name,name_alias,title,image,viewed,sprice,price,description');
		$this->db->where('bl_active',1);
        $this->db->order_by('viewed','DESC');
        return $this->db->get('products',$limit,0)->result();
    }
	
	// Danh sách nhà đồng hành
	 function getNhadonghanh($group_id){
		$this->db->where('bl_active',1);
        $this->db->order_by('banners_id','DESC');
        return $this->db->get('banners')->result();
    }
	
	
}